home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20010306-20010921 / 000217_fdc@watsun.cc.columbia.edu_Tue Jun 19 10:49:05 EDT 2001.msg < prev    next >
Text File  |  2020-01-01  |  3KB  |  85 lines

  1. Article: 12537 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!watsun.cc.columbia.edu!fdc
  3. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  4. Newsgroups: comp.protocols.kermit.misc
  5. Subject: Re: must write a soft including Kermit binary file send
  6. Date: 19 Jun 2001 14:48:43 GMT
  7. Organization: Columbia University
  8. Lines: 68
  9. Message-ID: <9gnoob$kn6$1@newsmaster.cc.columbia.edu>
  10. References: <9ghrnm$m59$1@front1m.grolier.fr> <3b2dbe15$1_2@news.datacomm.ch> <9gl0kj$l64$1@newsmaster.cc.columbia.edu> <3b2f3dae$1_1@news.datacomm.ch>
  11. NNTP-Posting-Host: watsun.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 992962123 21222 128.59.39.2 (19 Jun 2001 14:48:43 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 19 Jun 2001 14:48:43 GMT
  15. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:12537
  16.  
  17. In article <3b2f3dae$1_1@news.datacomm.ch>,
  18. jean-luc <jgriess@caramail.com> wrote:
  19. : please understand
  20. : - The OS-9 stuf is given and working, also if it is a older Kermit version.
  21. : - OS-9 is the target where "kermit ri" is waiting for files.
  22. What kind of computer is sending the files?  Does it have an operating
  23. system?
  24.  
  25. : I was reading some of your source files, like ckcfn2.c and gkermit.c, so 
  26. : its a great help, know about S, F, D-type packets.
  27. : The receiver OS-9 is waiting for files and send a NACK at regular
  28. : intervalls
  29. :
  30. : NACK is 01 23 20 4E 33 0D
  31. : where 01 is the start character
  32. : where 23 20 is the sequence number
  33. : where 4E ist the N for NACK
  34. : where 0D is the block end
  35. : what is the 33 for ?
  36. : is this a checksumm ?
  37. :
  38. 01 = Ctrl-A  Start of packet
  39. 23 = #       Length
  40. 20 = SP      Sequence number
  41. 4E = N       Type
  42. 33 = 3       Checksum
  43. 0D = CR      Terminator
  44.  
  45. : I have problems with the checksumm calculation.
  46. : I use the 1 Byte checksumm, type 1 so its all bytes anded with 177 and
  47. : summed, add higher bits and anded with 77 I dont find that result.
  48. Here's the formula from chk1() in ckcfn2.c:
  49.  
  50.   chk = (((chk & 0300) >> 6) + chk) & 077;
  51.  
  52. chk is the sum of the length, sequence, type, and data fields.  Before
  53. application of the formula, this is:
  54.  
  55.   23 + 20 + 4E = 91 (hex) = 221 (octal) = 145 (decimal)
  56.  
  57. In C, the numbers starting with 0 are octal.  You could write this in
  58. hexadecimal as:
  59.  
  60.   chk = (((chk & 0xC0) >> 6) + chk) & 0x3F;
  61.  
  62. and in decimal as:
  63.  
  64.   chk = (((chk & 192) >> 6) + chk) & 63;
  65.  
  66. Let's use hex, since that's what you used:
  67.  
  68.   chk = (((chk & 0xC0) >> 6) + chk) & 0x3F;
  69.   chk = (((0x91 & 0xC0) >> 6) + 0x91) & 0x3F;
  70.   chk = ((0x80 >> 6) + 0x91) & 0x3F;
  71.   chk = (0x02 + 0x91) & 0x3F
  72.   chk = (0x93 & 0x3F)
  73.   chk = 13
  74.  
  75. Then to make it printable we add 20 (hex) = 33, which is ASCII "3".
  76.  
  77. It's all in the book.  Maybe you can find a copy of it in your local
  78. library.
  79.  
  80. - Frank
  81.